<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
    <head>
        <title>Cart</title>
    </head>
    <body>
        <h1>Show Order</h1>
        <table>
            <tr>
                <th>
                    OrderId
                </th>
                <td>
                    <a th:text="${order.orderId}"></a>
                </td>
            </tr>
            <tr>
                <th>
                    Kundennummer
                </th>
                <td>
                    <a th:text="${order.customerId}"></a>
                </td>
            </tr>
            <tr>
                <th>
                    Gesamtpreis
                </th>
                <td>
                    <a th:text="${price}"></a>
                </td>
            </tr>
            <tr><td colspan="2">Bestellpositionen</td></tr>
            <tr th:each="position : ${order.positions}">
                <td th:text="${position.anzahl}"></td>
                <td th:text="${position.product.name}"></td>
                <td><a th:href="@{/ui/cart/delete/{positionId}/(positionId=${position.orderPositionId})}">Delete</a></td>
            </tr>            
        </table>
        <h1>Bestellposition hinzuf&uuml;gen</h1>
        <form th:action="@{/ui/cart/position}" method="POST" th:object="${orderPosition}">
            <!--input type="hidden" th:field="*{orderId}" th:value="${order.orderId}"/-->
            <table>
                <tr>
                    <td>Bestellnummer</td>
                    <td>
                        <input type="number" th:field="*{orderId}"/>
                    </td>
                </tr>
                <tr>
                    <td>Produktnummer</td>
                    <td>
                        <input type="number" th:field="*{productId}"/>
                    </td>
                </tr>
                <tr>
                    <td>Anzahl</td>
                    <td>
                        <input type="number" th:field="*{anzahl}"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" value="Create"/>
                    </td>
                </tr>
            </table>
        </form>
        <h1>Bestellübersicht als PDF</h1>
        <a th:href="@{/cart/print/{orderId}/Order.pdf(orderId=${order.orderId})}">The order as pdf.</a>
        <h2>Bestellung abschlie&szlig;en</h2>
        <form th:action="@{/ui/cart/finish/{orderId}(orderId=${order.orderId})}">
            <input type="submit" value="Bestellung aufgeben"/> 
        </form>
    </body>
</html>